import Mock from 'mockjs'

let lst: any[] = [];

export default {
  getStaisticalData: () => {
    // 产生随机数
    for (let i = 0; i < 7; i++) {
      lst.push(
        Mock.mock({
          苹果: Mock.Random.float(100, 8000, 0, 0),
          小米: Mock.Random.float(100, 8000, 0, 0),
          华为: Mock.Random.float(100, 8000, 0, 0),
          三星: Mock.Random.float(100, 8000, 0, 0),
          vivo: Mock.Random.float(100, 8000, 0, 0),
          魅族: Mock.Random.float(100, 8000, 0, 0)
        })
      )
    }

    return {
      code: 2000,
      data: {
        // 饼图
        videoData: [
          {
            name: '小米',
            value: 2900
          },
          {
            name: '苹果',
            value: 5000
          },
          {
            name: 'vivo',
            value: 3200
          },
          {
            name: '三星',
            value: 2100
          },
          {
            name: '华为',
            value: 3600
          },
          {
            name: '魅族',
            value: 1800
          }
        ],
        // 柱状图
        userData: [
          {
            date: '周一',
            new: 5,
            active: 200
          },
          {
            date: '周二',
            new: 2,
            active: 100
          },
          {
            date: '周三',
            new: 12,
            active: 230
          },
          {
            date: '周四',
            new: 8,
            active: 280
          },
          {
            date: '周五',
            new: 3,
            active: 150
          }
        ],
        // 折线图
        orderData: {
          date: ['20191001', '20191002', '20191003', '20191004', '20191005', '20191006', '20191007'],
          data: lst
        },
        tableData: [
          {
            room: 'A7-301',
            device: '数控机床',
            num: 12,
            date: '2016-05-03',
          },
          {
            room: 'A7-201',
            device: '3D打印机',
            num: 20,
            date: '2016-05-02',
          },
          {
            room: 'A7-305',
            device: '电脑',
            num: 50,
            date: '2016-03-03',
          },
          {
            room: 'A7-101',
            device: '三坐标测量机',
            num: 1,
            date: '2017-05-03',
          }
        ]
      }
    }
  }
}